<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://unpkg.com/vue"></script>
    <script>
        window.onload=function(){
            var app5 = new Vue({
                el: '#app-5',
                methods: {
                    reverseMessage: function () {
                        this.message = this.message.split('').reverse().join('')
                    },
                    addpeople: function(){
                        this.peoples.push ({name:this.name, age:this.age});
                    }
                },
                data:{

                    peoples:{

                    }
                }
            })
        }

    </script>
</head>
<body>
<div id="app-5">
    <p>{{ message }}</p>
    <button v-on:click="addpeople">添加</button>
    <button v-on:click="removeMessage">删除</button>
    <input v-model="name">
    <input v-model="age">
    <table border="1">
        <tr>
            <th>序号</th><th>姓名</th><th>年龄</th><th>操作</th>
        </tr>
        <tr v-for="(people,index) in peoples">
            <td>{{index+1}}</td><td>{{people.name}}</td><td>{{people.age}}</td>
        </tr>
    </table>
</div>
</body>
</html>